<?php
require_once('../../core.inc.php');
require_once('Model/SiteManage.php');
require_once('View/Smarty.php');
require_once('Model/DB.php');
require_once('Model/Validate.php');
require_once('Model/Pager.php');
require_once('Model/Uploader.php');
require_once('Plugin/Site.php');
$sys = new Model_SiteManage();
$sys->checkLogin();
$params = $_REQUEST;
$smarty = new View_Smarty($params);
$site   = new Model_Site();
$smarty->assign('site', $site);
mysql_connect('localhost','root','');
mysql_select_db("diamond_db");
mysql_query("set names utf8");

$site_id = $_GET ['id'];
$mailmap = $_GET ['emailmap'];
$db  = new Model_DB();
        $sql = sprintf( "select * from m_site_email WHERE SITE_ID = '$site_id' AND STATUS ='$mailmap'");
        $db->query($sql);
        $arr = array();
        while($res = $db->fetch()){

            $arr['toemail'] = $res["toemail"];
$arr['fromemail'] = $res["fromemail"];
$arr['bcc'] = $res["bcc"];
$arr['reply'] = $res["reply"];
$arr['letter_title'] = $res["letter_title"];
$arr['letter_content'] = $res["letter_content"];
        }

$arr['content'] = $sql;
echo json_encode($arr); //用json编码，然后发送
?>